﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpExt.Util
{
    public struct MaxMeanCount
    {
        private int _count;
        private int _maximum;
        private int _total;

        public void Value(int value)
        {
            ++_count;
            _total += value;
            if(value > _maximum)
                _maximum = value;
        }

        public void Reset()
        {
            _count = 0;
            _maximum = 0;
            _total = 0;
        }

        public int Count
        {
            get { return _count; }
        }

        public int Maximum
        {
            get { return _maximum; }
        }

        public int Total
        {
            get { return _total; }
        }

        public int Mean
        {
            get { return _count != 0 ? _total/_count : _total; }
        }


        public int KBytes
        {
            get { return (_total + 512)/1024; }
        }
    }
}
